package com.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by qt-akun-pc on 2015/1/22.
 */
public class Pager {
    public int currentPageNo = 1;
    static public int pageSize = 10;
    public int totalNum = 0;
    public int totalPage=1;


    public int getCurrentPageNo() {
        return currentPageNo;
    }

    public void setCurrentPageNo(int currentPageNo) {
        this.currentPageNo = currentPageNo;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalNum() {
        return totalNum;
    }

    public void setTotalNum(int totalNum) {
        this.totalNum = totalNum;
    }
    public int getTotalPage() {
        if(totalNum ==0){
            return 1;
        }
        if(totalNum % pageSize==0){
            this.totalPage =totalNum / pageSize;

        }else {
            this.totalPage =(totalNum / pageSize)+1;
        }
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public int getNextPage() {
        if(currentPageNo < getTotalPage()){
            return currentPageNo + 1;
        }
        return totalPage;
    }



    public int getPrePage() {
        if(currentPageNo>1){
            return currentPageNo-1;
        }
        return 1;
    }


}
